#if !defined(MODELANIM_H)
#define MODELANIM_H

#include "nodeworldobject.h"
#include "../meshcontainer.h"


namespace gunsmith
{
class CResourceModel;
class CResourceEffect;
class CResourceManager;
class CResourceEffectVariables;
class CResourceActiveTechnique;

/*! \class CNodeModel
	\brief Represents a model node in the scene graph. */
class CNodeModel : public CNodeWorldObject
{
public:
						CNodeModel	(CResourceModel *pResModel, CResourceEffect *pResEffect);
	virtual				~CNodeModel	();
	virtual void		Draw		();
	virtual void		DrawDebug	();
	virtual void		Update		(float fDelta, void *pData = NULL);

private:
	void	CreateBoneMatrices	(D3DXBONECOMBINATION *pBoneCombinationArray, DWORD iAttr, TMeshContainer *pContainer);
	void	DrawBoundingBox		(const D3DXFRAME *pFrameBase);
	void	DrawFrames			(D3DXFRAME *pFrameBase);
	void	DrawMesh			(TMeshContainer *pContainer, DWORD iAttr);
	void	SetupFrameMatrices	(D3DXFRAME *pFrameBase);
	void	UpdateFrameMatrices	(D3DXFRAME *pFrameBase, D3DXMATRIX *pMatrixParent);

	ID3DXAnimationController	*m_pAnimCtrl;
	IDirect3DDevice9			*m_pDevice;
	ID3DXEffect					*m_pEffect;
	D3DXFRAME					*m_pFrameRoot;
	CResourceModel				*m_pResModel;
	CResourceEffect				*m_pResEffect;
	CResourceEffectVariables	*m_pResEVars;
	CResourceActiveTechnique	*m_pResActiveTechnique;
};
};

#endif  //MODELANIM_H
